package com.imis.demo.springboot.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.imis.demo.thread.ThreadPoolUtils;
import com.imis.demo.thread.UuidThread;

@RestController
public class SampleController {
	private Logger LOG = LoggerFactory.getLogger(SampleController.class);
	@Value("${demo.name}")
	private String demoName;

	@RequestMapping(value = "/home", method = RequestMethod.GET)
	String home() {
		LOG.info("从application.properties获取的demoName值为：{}", demoName);
		return "Hello World!";
	}

	@RequestMapping(value = "/uuid", method = RequestMethod.GET)
	String uuid() {
		ThreadPoolUtils threadPoolUtils = ThreadPoolUtils.init();
		for (int i = 0; i < 100000; i++) {
			threadPoolUtils.execute(new UuidThread());
		}
		return "uuid generated!";
	}
}